/**
 * author yueshuai
 * 2017.5.2
 * 查找对象中的某个属性返回索引
 */
export const selectAttr = function(data,num,attr) {
	var index = 0;
	for(var i = 0; i<data.length; i++){
		if(attr !== undefined){
			if(num == data[i][attr]){
				index = i;
			}
		}else{
			for(var j in data[i]){
				if(num == data[i][j]){
					index = i;
				}
			}
		}
	}
	return index
}